package com.zhai.netty.learn.bytebuf;

import java.nio.ByteBuffer;

public class ByteBufDemon {
	public static void main(String[] args) {
		ByteBuffer buffer = ByteBuffer.allocate(100);
		String value = "zhai er yuan";
		buffer.put(value.getBytes());
		buffer.flip();
		byte[] bytes = new byte[buffer.remaining()];
		buffer.get(bytes);
		String decodeValue = new String(bytes); 
		System.out.println(decodeValue);
	}
}
